package controller

type ResCode int64

const (
	CodeSuccess ResCode = 1000 * iota
	CodeInvalidParam
	CodeUserExits
	CodeUserNotExits
	CodeInvalidPassword
	CodeServerBusy
)

var codeMsgMap = map[ResCode]string{
	CodeSuccess:    		"success",
	CodeInvalidParam: 		"请求参数错误",
	CodeUserExits: 			"用户名已存在",
	CodeUserNotExits: 		"用户名不存在",
	CodeInvalidPassword:	"用户名或密码错误",
	CodeServerBusy:   		"服务器繁忙",
}

func (c ResCode) GetMsg() string {
	 msg, ok := codeMsgMap[c]
	 if !ok {
		msg = codeMsgMap[CodeServerBusy]
	 }
	 return msg
}
